﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="DTC.DrugIssuePopup"
	x:Name="Window"
	Width="500" Height="500" Style="{StaticResource PopupWindow}">
	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../Resources/TextBlockStyles.xaml"/>
				<ResourceDictionary Source="../Resources/TextEditStyles.xaml"/>
                <ResourceDictionary Source="../Resources/Brushes.xaml"/>
                <ResourceDictionary Source="../Resources/ComboBoxesStyles.xaml"/>
                <ResourceDictionary Source="../Resources/ListBoxStyles.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</Window.Resources>

   <!-- <StackPanel x:Name="MainGrid" Margin="20">
        <TextBlock Text="Период времени расчета потребности:"
                   FontSize="11"/>
        <TextBox Name="PeriodTextBox" Width="150"
                 HorizontalAlignment="Center"
                 Margin="5,5,0,0"
                 SnapsToDevicePixels="True"/>
        <StackPanel Name="PackingStackPanel" 
                    Visibility="Collapsed"
                    Margin="0,40,0,0"></StackPanel>
        <Button Name="CalculateButton" 
                Height="40" Width="100"
                Margin="0,40,0,0" Click="CalculateButton_Click">
            <TextBlock Text="Расчитать"
                       FontSize="15"/>
            </Button>
        <TextBlock Text="Потребность: "
                   HorizontalAlignment="Center"
                   Margin="0,40,0,0"/>
        <Border BorderBrush="{StaticResource ListBorder}" 
                Background="White"
                BorderThickness="1"
                CornerRadius="4"
                Margin="20,10,20,20"
                VerticalAlignment="Center" HorizontalAlignment="Stretch">
        <TextBlock Name="ResultTextBlock" Text="0"
                   Width="Auto"
                   FontSize="17"
                   Margin="10,5,10,5"
                   HorizontalAlignment="Center" TextWrapping="Wrap" />
            </Border>
    </StackPanel>-->
    <Grid Margin="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <ListBox ItemContainerStyle="{StaticResource ColorListBoxItem}"
                 HorizontalContentAlignment="Stretch"
                 Name="PatientOrdersListBox">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Stretch">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.4*"/>
                            <ColumnDefinition Width="0.6*"/>
                        </Grid.ColumnDefinitions>
                        <Border BorderBrush="#FFCAD1FF" 
									BorderThickness="1" CornerRadius="3"
									Grid.Column="0" Grid.RowSpan="4" 
									Margin="4,4,2,4" HorizontalAlignment="Stretch">
                            <StackPanel Margin="5"
                                        HorizontalAlignment="Center" VerticalAlignment="Center">
                                <TextBlock Text="Заказ:" 
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           Foreground="Gray"
                                           FontSize="10"/>
                                <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                                    <TextBlock Text="{Binding DTCOrder.DateFrom, Mode=OneWay, StringFormat=dd.MM.yyyy}"/>
                                    <TextBlock Text=" - "/>
                                    <TextBlock Text="{Binding DTCOrder.DateTo, Mode=OneWay, StringFormat=dd.MM.yyyy}"/>
                                </WrapPanel>
                            </StackPanel>
                        </Border>
                        <Border Grid.Column="1"
                                BorderBrush="#FFCAD1FF"
                                BorderThickness="1" CornerRadius="3"
                                Margin="2,4,4,4" HorizontalAlignment="Stretch">
                            <StackPanel Margin="5" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                                <TextBlock Text="Препарат:"
                                           FontSize="10"
                                           Foreground="Gray"/>
                                <ListBox HorizontalAlignment="Center" ItemsSource="{Binding DTCPatientOrderedBoxes}">
                                    <ListBox.Style>
                                        <Style TargetType="{x:Type ListBox}">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type ListBox}">
                                                        <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                                                                      VerticalScrollBarVisibility="Auto">
                                                            <ItemsPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                                                        </ScrollViewer>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </ListBox.Style>
                                    <ListBox.ItemContainerStyle>
                                        <Style TargetType="{x:Type ListBoxItem}">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                                        <Grid Name="Ground">
                                                            <ContentPresenter SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2"/>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </ListBox.ItemContainerStyle>
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <WrapPanel HorizontalAlignment="Left" VerticalAlignment="Center">
                                                <TextBlock Text="{Binding DTCBox.FullName, Mode=OneWay}"/>
                                                <TextBlock Text=" - "/>
                                                <TextBlock Text="{Binding Count, Mode=OneWay}"/>
                                            </WrapPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>
                        </Border>    
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Window>